package com.fxhy.utils;

import java.io.IOException;
import java.io.InputStream;

public class FileUtils {

	public static byte[] multipartFileToByte(long fileSize,InputStream InputStream){
		byte[] b = null;
		InputStream is = InputStream;
		try{
			b = new byte[(int) fileSize];
			int read = 0;
			int i = 0;
			while ((read = InputStream.read()) != -1) {
				b[i] = (byte) read;
				i++;
			}
		}catch (Exception e) {
			e.printStackTrace();
		}finally {
			if(is!=null){
				try {
					is.close();
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}
		return b;
	}
	
}
